<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>1 bfc</title>
  <link rel="stylesheet" href="../../styles/index.css">
  <style>
    .box {
      background: #ccc;
      border: 5px solid orange;
      /* 解决办法：触发BFC机制 overflow float display position都可以，看项目需求  */
      overflow: hidden;
    }

    .float {
      float: left;
      width: 200px;
      height: 150px;
      background: gold;
      border: 1px solid green;
      padding: 10px;
    }
  </style>
</head>

<body>
  <div class="box">
    <div class="float">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Itaque nemo quae laborum.</div>
  </div>
</body>

</html>